package net.kodra.supereasy.traffic.server;

import net.kodra.supereasy.traffic.client.TrafficService;
import net.kodra.supereasy.traffic.shared.Schedule;
import net.kodra.supereasy.traffic.shared.Station;
import net.kodra.supereasy.traffic.shared.TransportationVehicle;
import net.kodra.supereasy.traffic.shared.UBahn;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class TrafficServiceImpl extends RemoteServiceServlet implements TrafficService
{

  /**
   * 
  **/
  private static final long serialVersionUID = 1L;

  @Override
  public Long registerClient()
  {
    // if required trigger some data collections
    TrafficManager.queueStationRequest(new Station("Goetheplatz"));
    TrafficManager.queueStationRequest(new Station("Goetheplatz"));
    return 123L;
  }

  @Override
  public Schedule[] getCurrentSchedule(String stationName) throws IllegalArgumentException
  {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public TransportationVehicle[] getUpdate() throws IllegalArgumentException
  {
    TransportationVehicle[] resultArray = new TransportationVehicle[1];
    UBahn uBahn = new UBahn(UBahn.Type.U3);
    resultArray[0] = uBahn;
    return resultArray;
  }

}